{{#if template}}
<template>
  <div >
    <DialogNew v-model="is_show" @close="close" title="title" width="500px" >
      <div class="padding-sm" v-loading="loading">
        <el-form :model="form" ref="formRef" :rules="rules" label-width="120px">
          <el-form-item label="名称" prop="name">
            <el-input v-model="form.name" placeholder="请输入名称" />
          </el-form-item>
        </el-form>
      </div>
      
      <template #footer>
        <el-button @click="is_show = false">取消</el-button>
        <el-button type="primary" @click="handleSubmit" v-repeat>确定</el-button>
      </template>
    </DialogNew>
  </div>
</template>
{{/if}}

{{#if script}}
<script setup>
  import DialogNew from '@/components/DialogNew/index.vue'

  const is_show = ref(false)

  const loading = ref(false)

  const form = reactive({
    id: undefined,
    name: '', 
    remarks: '',
  })
  const open = (row) => {
    const { id } = row
    form.id = id 
    is_show.value = true
  }

  const close = () => {}

  const rules = reactive({
    name: { required: true, message: '请输入名称', trigger: 'change' },
  })

  const emits = defineEmits(['fetch-data'])

  const formRef = ref(null)
  const handleSubmit = () => {
    formRef.value.validate((valid) => {
      if(valid) {
        loading.value = true
      }
    }).finally(() => {
      loading.value = false
    })
  }

  defineExpose({ open })
</script>
{{/if}}

{{#if style}}
<style lang="scss" scoped>

</style>
{{/if}}
